<?php

namespace App\Console\Commands\Manual;

use App\Models\Common\Wechat;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;

class WechatPayFix extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'wechat_pay_fix';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '测试红包修复bug';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        try{
            $payment = Wechat::payment();
            $redpack = $payment->redpack;
            $mchBillNo = 20200522000002;
            $info = $redpack->info($mchBillNo);
            $this->info(json_encode($info));
        }catch (\Exception $e){
            Log::emergency(WechatPayFix::class,['msg' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
        }
        return true;
    }
}
